package demo;

import java.util.Arrays;

//冒泡排序
public class Demo01 {
    public static void main(String[] args) {
        int[] arr = {10, 6, 5, 45, 4};
        /*for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                //比较
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }*/

        for (int i = 0; i < arr.length - 1; i++) {
            for (int i1 = 0; i1 < arr.length - 1 - i; i1++) {

            }
        }
        Arrays.sort(arr);
        System.out.println("排序后:" + Arrays.toString(arr));
        System.out.println();
    }
}
